import Vue from "vue";
import Button from "./button";
import ButtonGroup from "./button-group"
import Input from "./input"
import Row from "./row"
import Col from "./col"
import Nav from "./nav"
import Icon from "./icon";
import Layout from "./layout";
import Content from "./content";
import Footer from "./footer";
import Header from "./header";
import Sider from "./sider";
import plugin from './plugin'
import Popover from './popover'
import Tabs from './tabs'
import TabsHead from './tabs-head'
import TabsBody from './tabs-body'
import TabsItem from './tabs-item'
import TabsPane from './tabs-pane'
import Collapse from './collapse'
import CollapseItem from './collapse-item'
Vue.component('lm-icon',Icon)
Vue.component('lm-button',Button)
Vue.component('lm-group-button',ButtonGroup)
Vue.component('lm-input',Input)
Vue.component('lm-row',Row)
Vue.component('lm-col',Col)
Vue.component('lm-nav',Nav)
Vue.component('lm-layout',Layout)
Vue.component('lm-content',Content)
Vue.component('lm-footer',Footer)
Vue.component('lm-header',Header)
Vue.component('lm-sider',Sider)
Vue.component('lm-popover',Popover)
Vue.component('lm-tabs',Tabs)
Vue.component('lm-tabs-head',TabsHead)
Vue.component('lm-tabs-body',TabsBody)
Vue.component('lm-tabs-item',TabsItem)
Vue.component('lm-tabs-pane',TabsPane)
Vue.component('lm-collapse',Collapse)
Vue.component('lm-collapse-item',CollapseItem)
// 引入插件
Vue.use(plugin)
new Vue({
    el:"#app",
    data(){
        return {
            error:null,
            inputValue:'输入',
            tabsSelect:'therr',
            collapseSelect:"1",
            option:[
                {
                    label:'一级导航（1）',
                    menuCode:1,
                    icon:'reload',
                    children:[
                        {
                            label:'1-1',
                            menuCode:2,
                            icon:'reload',
                            children:[
                                {
                                    label:'1-1',
                                    menuCode:2,
                                    icon:'reload',
                                    callback(){
                                        console.log('hello world')
                                    }
                                },
                                {
                                    label:'1-2',
                                    menuCode:3,
                                    icon:'reload',
                                },
                                {
                                    label:'1-3',
                                    menuCode:4,
                                    icon:'reload',
                                }
                            ]
                        },
                        {
                            label:'1-2',
                            menuCode:3,
                            icon:'reload',
                        },
                        {
                            label:'1-3',
                            menuCode:4,
                            icon:'reload',
                        }
                    ]
                },
                {
                    label:'一级导航（2）',
                    menuCode:5,
                    children:[
                        {
                            label:'2-1',
                            menuCode:6,
                        },
                        {
                            label:'2-2',
                            menuCode:7,
                        }
                    ]
                },
                {
                    label:'一级导航（3）',
                    menuCode:8
                }
            ]
        }
    },
    mounted(){
        // 调用 toast
        // this.$toast()
    },
    methods:{
        yyy(){
            console.log('yyy')
        },
        buttonClick(){
            console.log(123)
        },
        errorChange(){
            if(this.error){
                this.error =null
            }else{
                this.error="错误提示"
            }
        },
        handler(item,index,level){
            console.log(item,index,level)
        },
        //显示 Toast
        showToast(position='top',msg='这是toast'){
            this.$toast(msg,{ 
                autoClose:true,
                autoCloseDelay:1500,
                enableHtml:true,
                position,
                closeButton:{
                    text:'知道了',
                    callback:(done)=>{
                        console.log('我点击了')
                        // done()
                    }
                }
            })
        }
    }
})